#ifndef __UTILITYFUNCTIONS_H__
#define __UTILITYFUNCTIONS_H__
#include "cuda_runtime_api.h"
#include <stdio.h>
#include <stdlib.h>


namespace Utility
{
	static void ErrorHandler(cudaError_t, const char*, int);

	static void ErrorHandler(cudaError_t p_currErr, 
							const char *p_file,
							int p_line)
	{
		if (p_currErr != cudaSuccess)
		{
			printf("The following error occured : %s in %s at %d",cudaGetErrorString(p_currErr), p_file, p_line);
			exit(EXIT_FAILURE);
		}
	}

#define HANDLE_ERROR(err)(ErrorHandler(err, __FILE__, __LINE__))
}

#endif // !__UTILITYFUNCTIONS_H__
